{include file="public/header" /}
<title>{:lang('筹码转让')}</title>
<header id="header" class="mui-bar mui-bar-nav">
    <div class="mui-pull-left PopupNavigation">
        <img src="/static/home/bl_1.png" alt="">
    </div>
    <h1 class="mui-title">{:lang('筹码转让')}</h1>
    <div class="mui-pull-right" style="display: none;">
        <div class="mui-switch mui-active" >
            <div class="mui-switch-handle"></div>
        </div>
    </div>
</header>    

{include file="public/menu" /}<div id="pullrefresh" class="mui-content mui-scroll-wrapper" >
    <div class="mui-scroll" style="transform: translate3d(0px, 0px, 0px) translateZ(0px); transition-duration: 0ms;">
        <div class="gistememBox">
            <div class="iwanvesttl">
                <span class="span_1">{:lang('当前可用筹码')}</span>
                <span class="span_2">${:number_format($user['chip'],2)}</span>
            </div>
            <form id="subForm">
                <div class="gistememinput df">
                    <div class="gistememinputtl">{:lang('会员账号')}:</div>
                    <div class="fx1">
                        <input type="text" name="toAccount" autocomplete="off" class="gisteinput" placeholder="{:lang('请输入会员账号')}">
                    </div>
                </div>
                <div class="gistememinput df">
                    <div class="gistememinputtl">{:lang('筹码')}:</div>
                    <div class="fx1">
                        <input type="number" name="toMoney" autocomplete="off" class="gisteinput" placeholder="{:lang('请输入转让筹码')}">
                    </div>
                </div>
                <div class="gistememinput df">
                    <div class="gistememinputtl">{:lang('支付密码')}:</div>
                    <div class="fx1">
                        <input type="password" name="token" autocomplete="off" class="gisteinput" placeholder="{:lang('请输入支付密码')}">
                    </div>
                </div>
                <div class="applicaageAnbox">
                    <button class="applicaageAn subForm" type="button">{:lang('完成转让')}</button>
                </div>

            <input type="hidden" name="__hash__" value="3a5544652fd46d3444e48075e8250e82_4dca33533b164adefb1a005f8ba26448"></form>
        </div>
        <div class="staataBox">
            <div class="staataTl">{:lang('筹码转让记录')}</div>
            <div class="staataTableBox">
                <table class="tabletada" border="0" cellspacing="" cellpadding="">
                    <thead>
                    <tr>
                        <th>{:lang('会员名')}</th>
                        <th>{:lang('转让金额')}</th>
                        <th>{:lang('转让时间')}</th>
                    </tr>
                    </thead>
                    <tbody id="content">
    
                    </tbody>
                </table>
            </div>
        </div>
    </div>
{include file="public/footer" /}

<script src="/static/home/echarts.min.js" type="text/javascript" charset="utf-8"></script>
<script>
    mui('.mui-scroll-wrapper').scroll({
        deceleration: 0.0005
    });
    mui('body').on('tap', ".nsfeithdan", function () {
        var id = $(this).data('id');
        mui.prompt(' ','请输入撤回金额',' 请输入撤回金额',['确认','取消'],function(e){
            if(e.index == 0) {
                if(e.value <= 0) {
                    mui.alert('请输入撤回金额');
                    return false;
                }
                mui.showLoading("撤回中","div");
                mask.show();//显示遮罩层
                document.activeElement.blur();
                var url = "/Change/withdrawalAmount.html";
                $.post(url, {id:id, num:e.value}, function(data) {
                    mask.close();//关闭遮罩层
                    mui.hideLoading();
                    if(data.status == 0) {
                        mui.toast(data.msg, {
                            duration: 'long',
                            type: 'div'
                        });
                    } else if(data.status == 1) {
                        mui.toast(data.msg, {
                            duration: '2000',
                            type: 'div'
                        });
                        page = 0;
                        ajaxGetContent();
                    }
                });
            }
        },'div');
        document.querySelector('.mui-popup-input input').type='number'
    });
    var mask=mui.createMask(),isSub = true;
    mui('body').on('tap', '.subForm', function() {
        var obj = $(this);
        if(isSub) {
            isSub = false;
            var data = $('#subForm').serialize();
            var url = "{:url('Change/changeAdd')}";
            mui.showLoading("提交中","div");
            mask.show();//显示遮罩层
            $.post(url, data, function(data) {
                mask.close();//关闭遮罩层
                mui.hideLoading();
                if(data.status == 0) {
                    isSub = true;
                    mui.toast(data.msg, {
                        duration: 'long',
                        type: 'div'
                    });
                } else if(data.status == 1) {
                    mui.toast(data.msg, {
                        duration: '2000',
                        type: 'div'
                    });
                    window.location.reload();
                }
            });
        }
    });
    $(document).ready(function () {
        ajaxGetContent();
    });
    var page = 0,stop = true;

    function ajaxGetContent() {
        if (stop == true || page == 0) {
            stop = false;
            if (page == 0) {
                $('#content').html('');
            }

            $.ajax({
                type: "POST",
                url: "{:url('Change/ChangeAddLog')}",//+tab,
                data: {p: page},
                success: function (data) {
                    page += 1;
                    $('.loadAdd').hide();
                    // layer.close(getMoreLoad);
                    if ($.trim(data) == '') {
                        stop = false;
                        if (page >= 2) {
                            $('.loadAdd_bottom').show();
                        } else if (page == 1) {
                            $('.loadAdd_nodata').show();
                        }
                    } else {
                        stop = true;
                        let html = '';
                        for(var i = 0;i<data.list.length;i++){
                            html += '<tr><td>'+data.list[i].toname+'</td>';
                            html += '<td>'+data.list[i].num+'</td><td>'+data.list[i].created+'</td>';
                            html += '</tr>';
                        }
                        $('#content').append(html);
                    }
                }, error: function () {
                    mui.toast('网络失败，请刷新后重试', {duration: 'long', type: 'div'})
                }
            });
        }
    }
</script>


</body></html>